<?php echo $this->render('frontend_common/header.phtml'); ?>
<?php $this->headLink()->appendStylesheet($this->baseUrl('css/admintable.css')); ?>
<div id="Content">
<div style="margin-left: 20px">
<table style="width:960px; margin-top: 30px;margin-right: 20px">
	<tr>
		<thead>
		<th>ID</th>
		<th>Khách hàng ID</th>
		<th>Hình thức thanh toán</th>
		<th>Ngày đặt hàng</th>
		<th>Ngày giờ hẹn giao hàng</th>
		<th>Trạng thái</th>
		<th>Tên người nhận</th>
		<th>Địa chỉ nhận</th>
		<th>Thông điệp</th>
		<th></th>
		</thead>
	</tr>
<?php 
	$active_img_url = $this->baseurl('images/system/active.png');
	$notactive_img_url = $this->baseurl('images/system/disable.png');
	foreach ($this->dondathang as $key=>$motddh) 
	{
	?>
	<tr
	<?php
			if ($key % 2 != 0)
				echo ('class="changecolor1" style="background-color:#f3f3f3;"');
			else
				echo ('class="changecolor2" style="background-color:#FFF;"');
		?>
	>
		<td><?php echo $motddh['id']?></td>
		<td>
		<a href="<?php echo $this->url(array('controller'=>'admin','action'=>'customerdetail','id_kh'=>$motddh['khachhang_id'])); ?>">
		<?php echo $motddh['khachhang_id']?>
		</a>
		</td>
		<td><?php echo $motddh['hinhthucthanhtoan'] ?></td>
		<td><?php echo $motddh['ngaydathang'] ?></td>
		<td><?php echo $motddh['ngay_giohengiaohang'] ?></td>
		<td>
		<?php
		if($motddh['trangthai']==0)
			echo '<img src="'.$notactive_img_url.'" alt="actived icon" title="Chưa giao hàng"/>';
		else 
			echo '<img src="'.$active_img_url.'" alt="actived icon" title="Đã giao hàng"/>'; 
		?>
		</td>
		<td><?php echo $motddh['tennguoinhan'] ?></td>
		<td><?php echo $motddh['diachinhan'] ?></td>
		<td><?php echo $motddh['thongdiep'] ?></td>
		<td class="command">
			<a href="<?php echo $this->url(array('controller'=>'admin','action'=>'deleteoder','id_ddh'=>$motddh['id'])) ?>">
			<img title="Xóa đơn đặt hàng" class="tool_img" src="<?php echo $this->baseUrl("images/system/deleteicon.jpg") ?>" />
			</a>
			<a href="<?php echo $this->url(array('controller'=>'admin','action'=>'oderdetail','id_ddh'=>$motddh['id'])) ?>">
			<img title="Xem chi tiết" class="tool_img" alt="Sửa thông tin" src="<?php echo $this->baseUrl("images/system/detail.png") ?>" />
			</a>
			<?php if($motddh['trangthai']==0){ ?>
				<a href="<?php echo $this->url(array('controller'=>'admin','action'=>'updatestaus','id_ddh'=>$motddh['id'])) ?>">Đã giao hàng</a>
			<?php } ?>
			
		</td>
	</tr>
<?php 
	}
?>
</table>
<a style="border: 1px solid red; background-color: white; border-radius:5px 5px 5px; padding:5px ;font-weight: bold;color: black;text-decoration: none; margin-top: 30px; float: left;margin-bottom: 30px " href="<?php echo $this->baseUrl('admin/index') ?>">Admin page</a>
<?php echo $this->render('frontend_common/footer.phtml'); ?>